# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>

_gemname=gobject-introspection
pkgname="ruby-$_gemname"
pkgver=4.3.0
pkgrel=1
pkgdesc='Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection.'
arch=('x86_64' 'aarch64')
url='http://ruby-gnome2.sourceforge.jp/'
license=('LGPL2.1')
depends=('ruby' 'gobject-introspection-runtime' "ruby-glib2=$pkgver")
makedepends=('gobject-introspection' 'ruby-native-package-installer')
options=(!emptydirs)
source=("https://rubygems.org/gems/$_pkgname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
sha512sums=('8834a752d321733744565169761540cdf8b8e435b6a5a67a79d7cb6d2ce66ac0938a8bcfae6f28bfe28cf1149caa91d7ff01dc9363cb1adbb9bfc017865d4cdc')

package() {
  local _gemdir="$(ruby -e'puts Gem.default_dir')"
  local _platform="$(gem env platform | cut -d':' -f2)"
  local _extension_api_version="$(ruby -e'puts Gem.extension_api_version')"

  gem install --ignore-dependencies --no-user-install --no-document \
    -i "$pkgdir/$_gemdir" -n "$pkgdir/usr/bin" $_gemname-$pkgver.gem
  rm -f "$pkgdir/$_gemdir/cache/$_gemname-$pkgver.gem" \
    ${pkgdir}/${_gemdir}/gems/${_gemname}-${pkgver}/ext/gobject-introspection/*.o \
    "${pkgdir}/${_gemdir}/extensions/${_platform}/${_extension_api_version}/${_gemname}-${pkgver}/gem_make.out" \
    "${pkgdir}/${_gemdir}/gems/${_gemname}-${pkgver}/ext/gobject-introspection/Makefile"
}

